package com.example.liao.day9_21;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity {

    private BarrageView bv_show;
    private EditText et_show;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        bv_show = findViewById(R.id.bv_show);
        et_show = findViewById(R.id.et_show);
        VideoView videoView = findViewById(R.id.video_view);

        String path = "http://pic.ibaotu.com/00/20/08/96e888piCHck.mp4";
        videoView.setVideoPath(path);
        videoView.setMediaController(new MediaController(this));
        videoView.requestFocus();
        videoView.start();
    }

    public void onClick(View v) {
        bv_show.addMessage(et_show.getText().toString());
        et_show.getText().clear();
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
    }
}
